package cn.neusoft.mapper;

import cn.neusoft.domain.*;
import cn.neusoft.query.BaseQuery;
import java.util.List;

import cn.neusoft.vo.ExchangeOrderBean;
import cn.neusoft.vo.NormalOrderBean;
import cn.neusoft.vo.ReturnOrderBean;
import org.apache.ibatis.annotations.Param;

public interface OrderMapper {
  Long findOccupiedAmount(String commodity_id);//查询库存量
  Long findTrueAmount(String commodity_id);//查询实时库存量
  void judgeAmount(Order order);//修改订单状态
  Long findNormalOrderAmount(String commodity_id);//查询正常订单订货数
  Long findExchangeOrderAmount(String commodity_id);//查询换货订单订货数
  void addOrder(Order order);//新增父类型订单
  void addOrder_normal(Order_normal order_normal);//新增子类型正常订单
  void addOrder_exchange(Order_exchange order_exchange);//新增子类型换货订单
  void addOrder_return(Order_return order_return);//新增子类型退货订单
  List<Order> findCustoOrderByPage(BaseQuery query);//查询客户下属订单

  NormalOrderBean findNormalOrder(Order order);  //查询正常订单

  ExchangeOrderBean findExchangeOrder(Order order);  //查询换货订单

  ReturnOrderBean findReturnOrder(Order order);  //查询退货订单

  void updateoccupamount(@Param("commodity_id") String commodity_id,@Param("occupied_amount")Long occupied_amount);//修改虚拟库存

  List<NormalOrderBean> findOrderNormalByCondition(BaseQuery query);

  List<ExchangeOrderBean> findOrderExchangeByCondition(BaseQuery query);

  List<ReturnOrderBean> findOrderReturnByCondition(BaseQuery query);


  /**
   * 下面这几个方法是冗余的，是为了使服务间通信的时候能简单点写的
   * 我不想改已经和前端连好，能正常运行的方法了，出问题就寄了
   * 所以写了这几个冗余的方法
   */

  Order1 findOrderNormalByCondition1(BaseQuery query);

  Order1 findOrderExchangeByCondition1(BaseQuery query);

  Order1 findOrderReturnByCondition1(BaseQuery query);


  List<Order1> findOrderNormalListByCondition(BaseQuery query);

  List<Order1> findOrderExchangeListByCondition(BaseQuery query);

  List<Order1> findOrderReturnListByCondition(BaseQuery query);

  void updateOrderStatus(Order1 order);

  void updateOrderStatusWhenCreate(Order order);

  void updateOrderRestock(Order order);

  List<Order> findAll();
  int countMatchingOrders(String commodity_id);
}
